local hx__zhangchao = fk.CreateSkill({
  name = "hx__zhangchao",
  tags = { Skill.Compulsory },
})

local spec = {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(hx__zhangchao.name) then return end
    local card_type = data.card.type
    -- if card_type == Card.TypeEquip then
    --   if not table.contains(target:getCardIds("e"), data.card:getEffectiveId()) then return end
    -- end
    if card_type == Card.TypeEquip then
      if player:getTableMark("@hx__zhangchao-turn")[1] ~= nil then
        return player:getTableMark("@hx__zhangchao-turn")[1] < 1
      else
        return true
      end
    elseif card_type == Card.TypeTrick then
      if player:getTableMark("@hx__zhangchao-turn")[2] ~= nil then
        return player:getTableMark("@hx__zhangchao-turn")[2] < 1
      else
        return true
      end
    elseif card_type == Card.TypeBasic then
      if player:getTableMark("@hx__zhangchao-turn")[3] ~= nil then
        return player:getTableMark("@hx__zhangchao-turn")[3] < 1
      else
        return true
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, hx__zhangchao.name)
    local e
    local t
    local b
    if player:getTableMark("@hx__zhangchao-turn")[1] == nil then
      e = 0
    else
      e = player:getTableMark("@hx__zhangchao-turn")[1]
    end
    if player:getTableMark("@hx__zhangchao-turn")[2] == nil then
      t = 0
    else
      t = player:getTableMark("@hx__zhangchao-turn")[2]
    end
    if player:getTableMark("@hx__zhangchao-turn")[3] == nil then
      b = 0
    else
      b = player:getTableMark("@hx__zhangchao-turn")[3]
    end
    if data.card.type == Card.TypeEquip then
      e = e + 1
    elseif data.card.type == Card.TypeTrick then
      t = t + 1
    elseif data.card.type == Card.TypeBasic then
      b = b + 1
    end
    room:setPlayerMark(player, "@hx__zhangchao2-turn", {"装", "锦", "基"})
    room:setPlayerMark(player, "@hx__zhangchao-turn", {e, t, b})
  end,
}

hx__zhangchao:addEffect(fk.CardUsing, spec)
hx__zhangchao:addEffect(fk.CardResponding, spec)


return hx__zhangchao